/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ifpe.consistencies;

import java.util.regex.Pattern;

/**
 *
 * @author Sostenes
 */
public class Consistencies {

    public static void consistNotNull(Object obj, String message) {
        if (obj == null) {
            throw new IllegalArgumentException(message);
        }
    }

    public static void consistStringLength(int length, String str, String message) {
        if (str.length() != length) {
            throw new IllegalArgumentException(message);
        }
    }

    public static void consistNumeric(String str, String message) {
        if (!Pattern.matches("\\d*", str)) {
            throw new IllegalArgumentException(message);
        }

    }
}
